From aa37b847273b56403d15a187e3f1dface438f9a7 Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Mon, 8 Nov 2004 18:54:03 +0000 Subject: [PATCH] bitkeeper revision 1.1159.170.2 (418fc0cbyeYILYK3WoFh0bVv3e_-KA) Allow users of SAVE_ALL and SET_XEN_SEGMENTS to specify which register is to be clobbered on return. --- xen/arch/x86/x86_32/entry.S | 10 +++--- xen/include/asm-x86/irq.h | 6 ++-- xen/include/asm-x86/x86_32/asm_defns.h | 48 +++++++++++++------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/xen/arch/x86/x86_32/entry.S b/xen/arch/x86/x86_32/entry.S index 474b399b59..d0dba03cde 100644 --- a/xen/arch/x86/x86_32/entry.S +++ b/xen/arch/x86/x86_32/entry.S @@ -181,7 +181,7 @@ restore_all_guest: pushl %edx pushl %ecx pushl %ebx -7: SET_XEN_SEGMENTS +7: SET_XEN_SEGMENTS(a) jmp failsafe_callback .previous .section __ex_table,"a" @@ -239,7 +239,7 @@ restore_all_xen: ALIGN ENTRY(hypercall) pushl %eax # save orig_eax - SAVE_ALL + SAVE_ALL(b) sti GET_CURRENT(%ebx) andl $(NR_hypercalls-1),%eax @@ -351,7 +351,7 @@ FAULT12:movl %eax,%gs:8(%esi) .section .fixup,"ax" crash_domain_fixup1: subl $4,%esp - SAVE_ALL + SAVE_ALL(a) sti jmp domain_crash crash_domain_fixup2: @@ -410,7 +410,7 @@ error_code: movl %es,XREGS_es(%esp) movl %fs,XREGS_fs(%esp) movl %gs,XREGS_gs(%esp) -1: SET_XEN_SEGMENTS +1: SET_XEN_SEGMENTS(b) movl XREGS_orig_eax(%esp),%esi # get the error code movl XREGS_eax(%esp),%edi # get the function address movl %eax,XREGS_eax(%esp) @@ -508,7 +508,7 @@ ENTRY(nmi) # Save state but do not trash the segment registers! # We may otherwise be unable to reload them or copy them to ring 1. pushl %eax - SAVE_ALL_NOSEGREGS + SAVE_ALL_NOSEGREGS(a) # Check for hardware problems. inb $0x61,%al diff --git a/xen/include/asm-x86/irq.h b/xen/include/asm-x86/irq.h index 3b71f7f0a0..f0a8955fa9 100644 --- a/xen/include/asm-x86/irq.h +++ b/xen/include/asm-x86/irq.h @@ -92,7 +92,7 @@ __asm__( \ "\n"__ALIGN_STR"\n" \ SYMBOL_NAME_STR(x) ":\n\t" \ "push"__OS" $"#v"\n\t" \ - SAVE_ALL \ + SAVE_ALL(a) \ SYMBOL_NAME_STR(call_##x)":\n\t" \ "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \ "jmp ret_from_intr\n"); @@ -105,7 +105,7 @@ __asm__( \ "\n"__ALIGN_STR"\n" \ SYMBOL_NAME_STR(x) ":\n\t" \ "push"__OS" $"#v"\n\t" \ - SAVE_ALL \ + SAVE_ALL(a) \ "mov %"__OP"sp,%"__OP"ax\n\t" \ "push %"__OP"ax\n\t" \ SYMBOL_NAME_STR(call_##x)":\n\t" \ @@ -118,7 +118,7 @@ asmlinkage void call_do_IRQ(void); \ __asm__( \ "\n" __ALIGN_STR"\n" \ "common_interrupt:\n\t" \ - SAVE_ALL \ + SAVE_ALL(a) \ SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \ "call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \ "jmp ret_from_intr\n"); diff --git a/xen/include/asm-x86/x86_32/asm_defns.h b/xen/include/asm-x86/x86_32/asm_defns.h index 0f022d38a2..37efa67879 100644 --- a/xen/include/asm-x86/x86_32/asm_defns.h +++ b/xen/include/asm-x86/x86_32/asm_defns.h @@ -53,7 +53,7 @@ /* AUTO-GENERATE the following two cases (quoted vs. unquoted). */ #ifndef __ASSEMBLY__ -#define __SAVE_ALL_PRE \ +#define __SAVE_ALL_PRE(_reg) \ "cld;" \ "pushl %eax;" \ "pushl %ebp;" \ @@ -62,31 +62,31 @@ "pushl %edx;" \ "pushl %ecx;" \ "pushl %ebx;" \ - "movb "STR(XREGS_cs)"(%esp),%al;" \ - "testb $3,%al;" \ + "movb "STR(XREGS_cs)"(%esp),%"STR(_reg)"l;" \ + "testb $3,%"STR(_reg)"l;" \ "je 1f;" \ "movl %ds,"STR(XREGS_ds)"(%esp);" \ "movl %es,"STR(XREGS_es)"(%esp);" \ "movl %fs,"STR(XREGS_fs)"(%esp);" \ "movl %gs,"STR(XREGS_gs)"(%esp);" -#define SAVE_ALL_NOSEGREGS \ - __SAVE_ALL_PRE \ +#define SAVE_ALL_NOSEGREGS(_reg) \ + __SAVE_ALL_PRE(_reg) \ "1:" -#define SET_XEN_SEGMENTS \ - "movl $("STR(__HYPERVISOR_DS)"),%edx;" \ - "movl %edx,%ds;" \ - "movl %edx,%es;" +#define SET_XEN_SEGMENTS(_reg) \ + "movl $("STR(__HYPERVISOR_DS)"),%e"STR(_reg)"x;" \ + "movl %e"STR(_reg)"x,%ds;" \ + "movl %e"STR(_reg)"x,%es;" -#define SAVE_ALL \ - __SAVE_ALL_PRE \ - SET_XEN_SEGMENTS \ +#define SAVE_ALL(_reg) \ + __SAVE_ALL_PRE(_reg) \ + SET_XEN_SEGMENTS(_reg) \ "1:" #else -#define __SAVE_ALL_PRE \ +#define __SAVE_ALL_PRE(_reg) \ cld; \ pushl %eax; \ pushl %ebp; \ @@ -95,26 +95,26 @@ pushl %edx; \ pushl %ecx; \ pushl %ebx; \ - movb XREGS_cs(%esp),%dl; \ - testb $3,%dl; \ + movb XREGS_cs(%esp),% ## _reg ## l; \ + testb $3,% ## _reg ## l; \ je 1f; \ movl %ds,XREGS_ds(%esp); \ movl %es,XREGS_es(%esp); \ movl %fs,XREGS_fs(%esp); \ movl %gs,XREGS_gs(%esp); -#define SAVE_ALL_NOSEGREGS \ - __SAVE_ALL_PRE \ +#define SAVE_ALL_NOSEGREGS(_reg) \ + __SAVE_ALL_PRE(_reg) \ 1: -#define SET_XEN_SEGMENTS \ - movl $(__HYPERVISOR_DS),%edx; \ - movl %edx,%ds; \ - movl %edx,%es; +#define SET_XEN_SEGMENTS(_reg) \ + movl $(__HYPERVISOR_DS),%e ## _reg ## x; \ + movl %e ## _reg ## x,%ds; \ + movl %e ## _reg ## x,%es; -#define SAVE_ALL \ - __SAVE_ALL_PRE \ - SET_XEN_SEGMENTS \ +#define SAVE_ALL(_reg) \ + __SAVE_ALL_PRE(_reg) \ + SET_XEN_SEGMENTS(_reg) \ 1: #endif -- 2.30.2